//
//  NSString+Category.h
//  lc-collect
//
//  Created by mac on 2021/3/2.
//

#import <Foundation/Foundation.h>

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (Category)

#pragma mark - 转化

/// 字典转Json字符串
+ (NSString *)dicToJSONStringWith:(NSDictionary *)dic;

/// JSON字符传转化成字典
- (NSDictionary *)jsonStringToDictionary;

/// NSString转为NSNumber
- (NSNumber *)stringToNumber;

#pragma mark - other

/// 取出HTML
- (NSString *)htmlToString;

/// 抹除小数末尾的0
- (NSString *)removeUnwantedZero;

/// 去掉前后空格
- (NSString *)trimmedString;

/// 电话号码中间4位*显示 135*****262
/// @param phoneNum 电话号码
+ (NSString *)getSecrectStringWithPhoneNumber:(NSString*)phoneNum;

/// 银行卡号中间8位*显示
/// @param accountNo 银行卡号
+ (NSString *)getSecrectStringWithAccountNo:(NSString*)accountNo;

/// 转为手机格式，默认为- “133-3333-5555”
/// @param mobile mobile
+ (NSString *)stringMobileFormat:(NSString*)mobile;

/// 金额数字添加单位（暂时写了万和亿，有更多的需求请参考写法来自行添加）
/// @param value 金额
+ (NSString *)stringChineseFormat:(double)value;

/// 添加数字的千位符
/// @param num #
+ (NSString *)countNumAndChangeformat:(NSString *)num;

/// 生成随机字符串
+ (NSString *)getRandomString:(NSInteger)place;

/// 复制到粘贴板
- (void)copyToPasteboard;

/// 打电话
- (void)makePhone;

#pragma mark - base64

/// 字符串加密为base64
- (NSString *)base64StringFromText;

/// 加密字符串解析
- (NSString *)textFromBase64String;

#pragma mark - URL
/// URL编码
- (NSString *)lc_UrlEncodedString;

/// URL解码
- (NSString *)lc_UrlDecodedString;

#pragma mark - 计算size

/// 计算文字高度
/// @param fontSize 字体
/// @param width 最大宽度
- (CGFloat)heightWithFontSize:(CGFloat)fontSize width:(CGFloat)width;

/// 计算文字宽度
/// @param fontSize 字体
/// @param maxHeight 最大高度
- (CGFloat)widthWithFontSize:(CGFloat)fontSize height:(CGFloat)maxHeight;

#pragma mark - 判断

/// 密码是否为数字和字母混合 strong password
- (BOOL)isPasswordStrong;

/// 是否在范围内
/// @param min 小
/// @param max 大
- (BOOL)isLengthInRange:(NSInteger)min max:(NSInteger)max;

/// emoji 检查 包含
- (BOOL)isContainsEmoji;

///判断当前字符是否emoji
- (BOOL)isEmoji;

/// 空
+ (BOOL)isEmpty:(NSString *)str;
- (BOOL)isEmpty;

@end

NS_ASSUME_NONNULL_END
